public class Page {

	private String title;
	private String text;

	private Page() {
	}

	public Page(String title) {
		this();
		setTitle(title);
	}

	public void addText(String newText) {
		if (newText != null) {
			if (text != null) {
				text += " " + newText;
			} else
				text = newText;
		}
	}

	public void removeText() {
		text = "";
	}

	public void viewPage() {
		System.out.println(title);
		System.out.println(text);
	}

	private String getTitle() {
		return title;
	}

	private void setTitle(String title) {
		if (title != null) {
			this.title = title;
		} else
			this.title = "";

	}

	public boolean searchWord(String word) {
		if (word != null && !word.equals(""))
			return text.contains(word);
		return false;
	}

	public boolean containsDigits() {
		if (text != null && !text.equals(""))
			return text.matches(".*\\d.*");
		return false;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}
}
